#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	cin >> n;
	char arr[1101];
	getchar();
	while (n--)
	{
		fgets(arr, 1101, stdin);
		int len = strlen(arr)-1;
		int count = 0;
		for (int i = 0; i < len; i++)
		{
			if (arr[i]  < 0)
			{
				count++;
			}
		}
		cout << count / 2<< endl;
	}
	return 0;
}